<!--
 * @Author: your name
 * @Date: 2020-09-16 17:56:09
 * @LastEditTime: 2020-09-17 19:38:29
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \open-platform-ui\platform-pc-console\src\components\main\components\side-menu\side-menu-item.vue
 -->
<template>
  <Submenu :name="`${parentName}`" :active-key="1">
    <template slot="title">
      <common-icon :type="parentItem.icon || ''" />
      <span>{{ showTitle(parentItem) }}</span>
    </template>
    <template v-for="item in children">
      <template v-if="item.children && item.children.length === 1">
        <side-menu-item
          v-if="showChildren(item)"
          :key="`menu-${item.name}`"
          :parent-item="item"
        ></side-menu-item>
        <menu-item
          v-else
          :name="getNameOrHref(item, true)"
          :key="`menu-${item.children[0].name}`"
          ><common-icon :type="item.children[0].icon || ''" /><span>{{
            showTitle(item.children[0])
          }}</span></menu-item
        >
      </template>
      <template v-else>
        <side-menu-item
          v-if="showChildren(item)"
          :key="`menu-${item.name}`"
          :parent-item="item"
        ></side-menu-item>
        <menu-item v-else :name="getNameOrHref(item)" :key="`menu-${item.name}`"
          ><common-icon :type="item.icon || ''" /><span>{{
            showTitle(item)
          }}</span></menu-item
        >
      </template>
    </template>
  </Submenu>
</template>
<script>
import mixin from './mixin'
import itemMixin from './item-mixin'
export default {
  name: 'SideMenuItem',
  mixins: [mixin, itemMixin]
}
</script>
